﻿using BCC.Common;
using BCC.DAO.Commodity;
using BCC.Model.commodity;
using BCC.Model.ModelsOut;
using BCC.Model.user;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Configuration;
using System.Text;

namespace BCC.ViewModel.commodity
{
    public class CommodityMainVM : INotifyPropertyChanged
    {

        public CommodityMainVM()
        {
            var commoditys = CommodityDB.selCommodity();
            Products = new ObservableCollection<SCommodity>(commoditys);
        }
        public event PropertyChangedEventHandler PropertyChanged;

        private ObservableCollection<SCommodity> products;
        public ObservableCollection<SCommodity> Products
        {
            get { return products; }
            set
            {
                products = value;
                OnPropertyChanged("Products");
            }
        }

        private ObservableCollection<SCommodity> shoppingCart;
        public ObservableCollection<SCommodity> ShoppingCart
        {
            get { return shoppingCart; }
            set
            {
                shoppingCart = value;
                OnPropertyChanged("ShoppingCart");
            }
        }

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        //public class Product
        //{
        //    public string Name { get; set; }
        //    public string ImageUrl { get; set; }
        //}

        public static string serverAddress = ConfigurationManager.AppSettings["serverAddress"].Trim();


    }
}
